/*
 * @(#)MaintSysParameterForm.java
 *
 * Copyright (c) 2003 DCIVision Ltd
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of DCIVision
 * Ltd ("Confidential Information").  You shall not disclose such Confidential
 * Information and shall use it only in accordance with the terms of the license
 * agreement you entered into with DCIVision Ltd.
 */
package com.dcivision.framework.web;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionMapping;

import com.dcivision.framework.ApplicationException;
import com.dcivision.framework.TextUtility;
import com.dcivision.framework.bean.AbstractBaseObject;
import com.dcivision.framework.bean.SysParameter;

/**
  MaintSysParameterForm.java

  This class is the for web form purpose.

  @author      Tony Lee
  @company     DCIVision Limited
  @creation date   01/06/2004
  @version     $Revision: 1.5 $
*/

public class MaintSysParameterForm extends AbstractActionForm {

  public static final String REVISION = "$Revision: 1.5 $";

  private String parameterCode = null;
  private String parameterValue = null;
  private String parameterDefaultValue = null;
  private String parameterType = null;
  private String description = null;


public String getParameterDefaultValue() {
	return parameterDefaultValue;
}

public void setParameterDefaultValue(String parameterDefaultValue) {
	this.parameterDefaultValue = parameterDefaultValue;
}
  public MaintSysParameterForm() {
    super();
  }

  public String getParameterCode() { 
    return(this.parameterCode);
  }

  public void setParameterCode(String parameterCode) { 
    this.parameterCode = parameterCode;
  }

  public String getParameterValue() { 
    return(this.parameterValue);
  }

  public void setParameterValue(String parameterValue) { 
    this.parameterValue = parameterValue;
  }

  public String getParameterType() { 
    return(this.parameterType);
  }

  public void setParameterType(String parameterType) { 
    this.parameterType = parameterType;
  }

  public String getDescription() { 
    return(this.description);
  }

  public void setDescription(String description) { 
    this.description = description;
  }
  public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
    return super.validate(mapping, request);
  }

  public void reset(ActionMapping mapping, HttpServletRequest request) {
    super.reset(mapping, request);
    this.setID(null);
    this.setParameterCode(null);
    this.setParameterValue(null);
    this.setParameterDefaultValue(null);
    this.setParameterType(null);
    this.setDescription(null);
    this.setRecordStatus(null);
    this.setUpdateCount(null);
    this.setCreatorID(null);
    this.setCreateDate(null);
    this.setUpdaterID(null);
    this.setUpdateDate(null);
  }

  public AbstractBaseObject getFormData() throws ApplicationException {
    SysParameter tmpSysParameter = new SysParameter();
    tmpSysParameter.setID(TextUtility.parseIntegerObj(this.getID()));
    tmpSysParameter.setParameterCode(this.getParameterCode());
    tmpSysParameter.setParameterValue(this.getParameterValue());
    tmpSysParameter.setParameterDefaultValue(this.getParameterDefaultValue());
    tmpSysParameter.setParameterType(this.getParameterType());
    tmpSysParameter.setDescription(this.getDescription());
    tmpSysParameter.setRecordStatus(this.getRecordStatus());
    tmpSysParameter.setUpdateCount(TextUtility.parseIntegerObj(this.getUpdateCount()));
    tmpSysParameter.setCreatorID(TextUtility.parseIntegerObj(this.getCreatorID()));
    tmpSysParameter.setCreateDate(parseTimestamp(this.getCreateDate()));
    tmpSysParameter.setUpdaterID(TextUtility.parseIntegerObj(this.getUpdaterID()));
    tmpSysParameter.setUpdateDate(parseTimestamp(this.getUpdateDate()));
    return tmpSysParameter;
  }

  public void setFormData(AbstractBaseObject baseObj) throws ApplicationException {
    SysParameter tmpSysParameter = (SysParameter)baseObj;
    this.setID(TextUtility.formatIntegerObj(tmpSysParameter.getID()));
    this.setParameterCode(tmpSysParameter.getParameterCode());
    this.setParameterValue(tmpSysParameter.getParameterValue());
    this.setParameterDefaultValue(tmpSysParameter.getParameterDefaultValue());
    this.setParameterType(tmpSysParameter.getParameterType());
    this.setDescription(tmpSysParameter.getDescription());
    this.setRecordStatus(tmpSysParameter.getRecordStatus());
    this.setUpdateCount(TextUtility.formatIntegerObj(tmpSysParameter.getUpdateCount()));
    this.setCreatorID(TextUtility.formatIntegerObj(tmpSysParameter.getCreatorID()));
    this.setCreateDate(formatTimestamp(tmpSysParameter.getCreateDate()));
    this.setUpdaterID(TextUtility.formatIntegerObj(tmpSysParameter.getUpdaterID()));
    this.setUpdateDate(formatTimestamp(tmpSysParameter.getUpdateDate()));
  }
}
